package parameter

import (
	"gf-assistant/internal/common"
	"github.com/gogf/gf/v2/frame/g"
)

type GetOrgComboxReq struct {
	g.Meta `path:"/combox" method:"post"`
}
type GetOrgComboxRes struct {
	Detail []*OrgComboxRes `json:"detail" description:"结点"`
}
type OrgComboxRes struct {
	Id       uint            `json:"id" description:"Id"`
	PId      uint            `json:"pId" description:"父Id"`
	Title    string          `json:"title" description:"显示Label"`
	Spread   bool            `json:"spread" description:"是否展开" d:"true"`
	Checked  bool            `json:"checked" description:"选中状态" d:"false"`
	Children []*OrgComboxRes `json:"children" description:"子节点"`
}
type GetOrgTreeReq struct {
	g.Meta `path:"/tree" method:"get"`
}
type GetOrgTreeRes struct {
	Detail []*OrgTreeRes `json:"detail" description:"结点"`
}
type OrgTreeRes struct {
	Id       uint          `json:"id" description:"Id"`
	PId      uint          `json:"pId" description:"父Id"`
	Title    string        `json:"title" description:"显示Label"`
	Remark   string        `json:"remark" description:"备注"`
	Spread   bool          `json:"spread" description:"是否展开" d:"true"`
	Checked  bool          `json:"checked" description:"选中状态" d:"false"`
	Children []*OrgTreeRes `json:"children" description:"子节点"`
}

type ListOrgReq struct {
	g.Meta       `path:"/list" method:"post"`
	OrgName      string `json:"orgName" dc:"机构名称"    `
	ParentId     uint   `json:"parentId" dc:"父机构" d:"0" `
	EnableStatus int    `json:"enableStatus"  d:"-1" dc:"有效状态：1-有效，0-无效，（-1）-全部"`
	common.CommonPaginationReq
}

type ListOrgRes struct {
	Detail []*GetOrgRes `json:"detail" description:"列表"`
	Total  int64        `json:"total" description:"数据总数"`
}
type GetOrgRes struct {
	OrgId            uint   `json:"orgId" dc:"机构ID"`
	ParentId         uint   `json:"parentId" dc:"父ID"`
	OrgName          string `json:"orgName" dc:"机构名称"`
	Remark           string `json:"remark" dc:"备注"`
	EnableStatus     uint   `json:"enableStatus" dc:"状态,1-有效，0-无效"`
	EnableStatusName string `json:"enableStatusName" dc:"状态名称"`
	CreatedUserName  string `json:"createdUserName" dc:"创建人"`
	CreatedTime      string `json:"createdTime" dc:"创建时间"`
	UpdatedTime      string `json:"updatedTime" dc:"修改时间"`
	UpdatedUserName  string `json:"updatedUserName" dc:"修改人"`
}
type SaveOrgReq struct {
	g.Meta       `path:"/save" method:"post"`
	OrgId        uint   `json:"orgId" dc:"机构ID"`
	ParentId     uint   `json:"parentId" dc:"父ID"`
	OrgName      string `json:"orgName" dc:"机构名称"`
	Remark       string `json:"remark" dc:"备注"`
	EnableStatus uint   `json:"enableStatus" dc:"状态,1-有效，0-无效"`
	operatorId   uint
}

func (s *SaveOrgReq) SetOperatorId(operatorId uint) {
	s.operatorId = operatorId
}
func (s *SaveOrgReq) GetOperatorId() uint {
	return s.operatorId
}

type SaveOrgRes struct {
	OrgId uint `json:"orgId" dc:"机构ID"`
}
